import React,{Component} from 'react'
import {Menu,Icon,Button,Modal} from 'antd'
import {inject, observer} from 'mobx-react'
import { FileAddOutlined, FolderAddOutlined } from '@ant-design/icons';
import AssetTagAddForm from 'components/asset-tag-add-form'

const {SubMenu} = Menu
/**
 * 名称：标签添加
 * 描述：标签添加
 * 调用：标签中心
 * 输入：tagStore 标签相关存储
 * 时间：20221124
 */
 @inject('tagStore')
 @observer
class AssetTagAdd  extends Component{
    constructor(props){
        super(props)
        this.state = {modalInvalid:false}
        
    }
   
    render(){
        const {tagStore} = this.props
        return (
            <div>
                <Button style={{width:"100%",border:0}} onClick={e=>{this.setState({modalInvalid:true})}} >
                    <FolderAddOutlined ></FolderAddOutlined>
                    新增标签
                </Button>
                <Modal
                    visible={this.state.modalInvalid}
                    title="添加标签"
                    footer={[]}
                    // onOk={()=>{
                    //     this.setState({modalInvalid:false})
                        
                    // }}
                    onCancel={()=>{this.setState({modalInvalid:false})}}
                    
                    >
                    <AssetTagAddForm handleSubmitMethod={(values)=>{
                        const {tagCode,tagName,cateName} = values
                        this.setState({modalInvalid:false})
                        tagStore.apiCreateTag(tagCode,tagName,cateName)
                        }}/>
                    
                </Modal> 
            </div>

                
        )
    }

    

}

export default AssetTagAdd